package com.peenongsaban.freelance.action;

import java.text.ParseException;

import com.opensymphony.xwork2.ActionSupport;
import com.peenongsaban.freelance.bean.AptitudeBean;
import com.peenongsaban.freelance.bean.PictureBean;
import com.peenongsaban.freelance.model.PostJobModel;
import com.peenongsaban.freelance.service.PostJobService;

public class PostJobAction extends ActionSupport {
	private static final long serialVersionUID = 1L;
	private PostJobModel model = new PostJobModel();

	public String execute() {
		return SUCCESS;
	}

	public String submitPostJob() throws ParseException {
		// postjob.getJob().setStartDateOfJob(DateFormatUtils.stringToDate_yyyMMdd(startDate));
		// postjob.getJob().setEndDateOfJob(DateFormatUtils.stringToDate_yyyMMdd(endDate));
		 System.out.println(model.getPostjob().getJob().getJobName());
		 for (AptitudeBean iterable_element : model.getPostjob().getListAptitude()) {
			System.out.println(iterable_element.getAptitudeID());
		}
		 System.out.println(model.getPostjob().getJob().getDescriptionOfJob());
		 System.out.println(model.getPostjob().getJob().getWorkArea());
		 System.out.println(model.getStartDate());
		 System.out.println(model.getEndDate());
		 for (PictureBean iterable_element : model.getPostjob().getJob().getListPicture()) {
				System.out.println(iterable_element.getPictureLocation());
			}
//		 model.postJob.job.paymentOfJob.paymentType.paymentTypeID
		 System.out.println(model.getPostjob().getJob().getPaymentOfJob().getPaymentType().getPaymentTypeID());
		 
		// System.out.println(postjob.getJob().getPaymentOfJob().getPaymentType().getPaymentTypeID());
		// System.out.println(postjob.getJob().getPaymentOfJob().getFixPrice());
		// System.out.println(postjob.getJob().getPaymentOfJob().getMinPrice());
		// System.out.println(postjob.getJob().getPaymentOfJob().getMaxPrice());
		 
		 
		 
		 
		 

		return SUCCESS;
	}

	public String preparePostJob() {
		PostJobService service = new PostJobService();
		model.setListPromotion(service.listAllPromotion());
		return SUCCESS;
	}

	public PostJobModel getModel() {
		return model;
	}

	public void setModel(PostJobModel model) {
		this.model = model;
	}

}
